home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
701-725
/
708
/
intuisup
/
intuisup42.lha
/
Intuisup
/
source.lha
/
Editor
/
main.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-21
|
5KB
|
191 lines
/* $Revision Header *** Header built automatically - do not edit! ***********
*
* (C) Copyright 1991 by Torsten Jürgeleit
*
* Name .....: main.c
* Created ..: Sunday 22-Dec-91 21:22:47
* Revision .: 0
*
* Date Author Comment
* ========= ==================== ====================
* 22-Dec-91 Torsten Jürgeleit Created this file!
*
****************************************************************************
*
* Main part
*
* $Revision Header ********************************************************/
/* Includes */
#include "includes.h"
#include "defines.h"
#include "imports.h"
#include "protos.h"
/* Globals */
struct IntuitionBase *IntuitionBase;
struct GfxBase *GfxBase;
struct ArpBase *ArpBase;
struct Library *IntuiSupBase = NULL; /* Clear for show_error() */
/*
struct Library *DiskfontBase;
struct Library *LayersBase;
*/
struct Screen wb_screen;
struct Window *ewin, *pwin;
struct TextAttr topaz60_attr = { (STRPTR)"topaz.font", TOPAZ_SIXTY,
FS_NORMAL, FPF_ROMFONT },
topaz80_attr = { (STRPTR)"topaz.font", TOPAZ_EIGHTY,
FS_NORMAL, FPF_ROMFONT };
STATIC struct NewWindow editor_new_window = {
EDITOR_WINDOW_LEFT, EDITOR_WINDOW_TOP, EDITOR_WINDOW_WIDTH,
EDITOR_WINDOW_HEIGHT, EDITOR_WINDOW_DETAIL_PEN, EDITOR_WINDOW_BLOCK_PEN,
EDITOR_WINDOW_IDCMP, EDITOR_WINDOW_FLAGS, NULL, NULL,
(UBYTE *)&editor_window_title[0], NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN
};
struct NewWindow project_new_window = {
0, 0, 0, 0, PROJECT_WINDOW_DETAIL_PEN, PROJECT_WINDOW_BLOCK_PEN,
PROJECT_WINDOW_IDCMP, PROJECT_WINDOW_FLAGS, NULL, NULL,
PROJECT_WINDOW_TITLE, NULL, NULL, PROJECT_WINDOW_MIN_WIDTH,
PROJECT_WINDOW_MIN_HEIGHT, -1, -1, WBENCHSCREEN
};
struct TemplateList template_list;
struct Template *selected_template,
*info_template;
struct Box current_box;
struct GadgetData *use_gd;
struct FileRequester *project_file_requester,
*csource_file_requester;
struct Dimension min_dimension[MAX_TEMPLATE_TYPES] = {
{ 20, 10 }, { 0, 0 }, { 20, 10 }, { 21, 11 }, { 50, 10 }, { 30, 8 },
{ 30, 8 }, { 20, 8 }, { 20, 8 }, { 50, 10 }, { 40, 10 },
{ 40, 30 }, { 60, 30 } };
APTR eri, pri, egl, eml, use_gl;
BYTE *default_mx_text_array[] = { "MX1", "MX2", NULL },
*default_cycle_text_array[] = { "Cycle", "Test 1", "Test 2", NULL },
*default_listview_text_array[] = { "Entry 1", "Entry 2", "Entry 3",
"Entry 4", "Entry 5", "Entry 6", "Entry 7", "Entry 8",
"Entry 9", "Entry 10", NULL };
BYTE editor_window_title[MAX_PROJECT_NAME_LEN + 3],
project_window_title[80];
USHORT snap_offset_table[] = { 1, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 };
USHORT editor_mode = DEFAULT_EDITOR_MODE,
snap_offset = DEFAULT_SNAP_OFFSET,
template_type = DEFAULT_TEMPLATE_TYPE;
USHORT modify_mode = 0, mouse_button = 0;
SHORT last_snap_x, last_snap_y;
BOOL info_displayed = FALSE;
/* Main routine */
LONG
main(VOID)
{
LONG return_code = RETURN_ERROR;
MWInit((BPTR)NULL, (LONG)MWF_NOATRASH);
if (IntuitionBase = OpenLibrary("intuition.library", 0L)) {
if (GfxBase = OpenLibrary("graphics.library", 0L)) {
if (!(ArpBase = OpenLibrary(ArpName, ArpVersion))) {
show_error(EDITOR_ERROR_NO_ARP);
} else {
if (!(IntuiSupBase = OpenLibrary(IntuiSupName,
IntuiSupVersion))) {
show_error(EDITOR_ERROR_NO_INTUISUP);
} else {
/*
if (DiskfontBase = OpenLibrary("diskfont.library", 0L)) {
if (LayersBase = OpenLibrary("layers.library", 0L)) {
*/
return_code = init_resources();
/*
CloseLibrary(LayersBase);
}
CloseLibrary(DiskfontBase);
}
*/
CloseLibrary(IntuiSupBase);
}
CloseLibrary(ArpBase);
}
CloseLibrary(GfxBase);
}
CloseLibrary(IntuitionBase);
}
MWTerm();
return(return_code);
}
/* Init resources */
LONG
init_resources(VOID)
{
SHORT status;
LONG return_code = RETURN_OK;
GetScreenData((BYTE *)&wb_screen, (LONG)sizeof(struct Screen), (LONG)
WBENCHSCREEN, (struct Screen *)NULL);
/* Init and open editor window */
if (!(eri = IGetRenderInfo((struct Screen *)NULL,
EDIT_RENDER_INFO_FLAGS))) {
status = EDITOR_ERROR_OUT_OF_MEM;
} else {
editor_new_window.LeftEdge = (wb_screen.Width -
editor_new_window.Width) / 2;
if (!(ewin = IOpenWindow(eri, &editor_new_window,
EDIT_OPEN_WINDOW_FLAGS))) {
status = EDITOR_ERROR_NO_WINDOW;
} else {
/* Init and open project window */
pri = NULL;
pwin = NULL;
if ((status = new_project_window(&template_list,
TEMPLATE_LIST_FLAG_DEFAULT_WINDOW)) == EDITOR_STATUS_NORMAL) {
/* Init ARP file requester structs */
if (!(project_file_requester = ArpAllocFreq())) {
status = EDITOR_ERROR_OUT_OF_MEM;
} else {
if (!(csource_file_requester = ArpAllocFreq())) {
status = EDITOR_ERROR_OUT_OF_MEM;
} else {
status = editor_action_loop();
}
}
}
/* Free resources */
if (pwin) {
ICloseWindow(pwin, FALSE);
pwin = NULL;
}
if (pri) {
IFreeRenderInfo(pri);
pri = NULL;
}
ICloseWindow(ewin, FALSE);
ewin = NULL;
}
IFreeRenderInfo(eri);
eri = NULL;
}
if (status < EDITOR_STATUS_NORMAL) {
show_error(status);
return_code = RETURN_ERROR;
}
return(return_code);
}